<template>
  <div>
     <el-table
      border
      :data="this.list"
      style="width: 100%">
      <el-table-column 
        prop="content"
        label="评价内容"
        width="180">
      </el-table-column>
       <el-table-column 
        label="点赞图标"
        width="180">
        <template slot-scope="scope">
        <img :src="choose(scope.row.id)">
        </template>
      </el-table-column>
       <el-table-column 
        prop="number"
        label="点赞数"
        width="180">
      </el-table-column>
     </el-table>
  </div>
</template>

<script>
import {mapState, mapActions, mapMutations} from "vuex"
export default {
    data(){
        return{
            lists:{},
            currentUser:{},
        }
    },

    computed:{
      ...mapState('user',["user"]),
      ...mapState('list',["list"]),
    },

    methods:{
      ...mapActions("user",["login"]),
      ...mapActions("list",["findAllComment"]),


      async choose(id){
          var result = await this.ajax.getSubmit("/api/comment/check/",{userId:this.user.id,commentId:id})
          
          if(result == true){
            return "../assets/zan_active.png";
          } else {
            return"../assets/zan.png";
          }
      }
    },

    created(){
      this.currentUser = this.$route.query.userLogin;
      this.findAllComment();

    },
}
</script>

<style>

</style>